package bean;

import java.util.Date;

public class Contact {
    private int contactId;
    private String contactName;
    public final static int MAX_CONTACT_NAME_LENGTH = 10;
    private int sex;
    public static final int MALE = 1;
    public static final int FEMALE = 0;
    public static final int UNKNOWN_SEX = -1;
    private Date birthdate;
    private String telephone;
    public final static int MAX_TELEPHONE_LENGTH = 15;
    /** 所在组的编号 */
    private int groupId;
    /** 创建此联系人的账户编号 */
    private int accountId;

    public int getContactId() {
        return contactId;
    }

    public void setContactId(int contactId) {
        this.contactId = contactId;
    }

    public String getContactName() {
        return contactName;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName;
    }

    public int getSex() {
        return sex;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public Date getBirthdate() {
        return birthdate;
    }

    public void setBirthdate(Date birthdate) {
        this.birthdate = birthdate;
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }

    public int getAccountId() {
        return accountId;
    }

    public void setAccountId(int accountId) {
        this.accountId = accountId;
    }
    
    public static int sex(int sex) {
        switch (sex) {
        case MALE:
            return MALE;
        case FEMALE:
            return FEMALE;
        default:
            return UNKNOWN_SEX;
        }
    }

    public Contact() {
    }

    public Contact(int groupId, int accountId) {
        this.groupId = groupId;
        this.accountId = accountId;
    }

    public Contact(String contactName, int sex, Date birthdate, String telephone) {
        this.contactName = contactName;
        this.sex = sex;
        this.birthdate = birthdate;
        this.telephone = telephone;
    }

    public Contact(String contactName, int sex, Date birthdate, String telephone, int groupId) {
        this.contactName = contactName;
        this.sex = sex;
        this.birthdate = birthdate;
        this.telephone = telephone;
        this.groupId = groupId;
    }

    public Contact(String contactName, int sex, Date birthdate, String telephone, int groupId, int accountId) {
        this.contactName = contactName;
        this.sex = sex;
        this.birthdate = birthdate;
        this.telephone = telephone;
        this.groupId = groupId;
        this.accountId = accountId;
    }

    public Contact(int contactId, String contactName, int sex, Date birthdate, String telephone, int groupId, int accountId) {
        this.contactId = contactId;
        this.contactName = contactName;
        this.sex = sex;
        this.birthdate = birthdate;
        this.telephone = telephone;
        this.groupId = groupId;
        this.accountId = accountId;
    }
}
